package org.ainlolcat.ainscience2.model.impl;

import org.ainlolcat.ainscience2.controller.loader.LoaderDefinition;
import org.ainlolcat.ainscience2.model.Configuration;
import org.ainlolcat.ainscience2.model.Entity;
import org.ainlolcat.ainscience2.model.Project;
import org.ainlolcat.ainscience2.model.filter.Filter;
import org.ainlolcat.ainscience2.model.filter.FilterApplier;

import java.util.Collection;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;

/**
 * Created by IntelliJ IDEA.
 * User: ain
 * Date: 17.06.12
 * Time: 1:34
 * To change this template use File | Settings | File Templates.
 */
public class ProjectImpl implements Project {
    //Vector is thread safe
    private Collection<Entity> entities = new Vector<Entity>();
    private Collection<String> namespaces = new Vector<String>();
    private Map<String,String> macroses = new Hashtable();
    private Configuration configuration;

    public Collection<Entity> getEntities(Filter... filters) {
        return new FilterApplier().apply(entities, filters);
    }

    public void addEntity(Entity entity) {
        entities.add(entity);
    }

    public Collection<String> getNamespaces() {
        return namespaces;
    }

    public void addNamespace(String namespace) {
        namespaces.add(namespace);
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public void setConfiguration(Configuration configuration) {
        this.configuration = configuration;
    }

    public String getMacros(String macros) {
        return macroses.get(macros);
    }

    public Map<String, String> getMacroses() {
        return macroses;
    }

    public void addMacros(String macros, String value) {
        macroses.put(macros, value);
    }
}
